<?php

namespace app\index\controller\consulting;

use app\index\model\UM as UM;
use app\index\service\MessageCardCommentService;
use ShidianUtil\Thinkphp\Response\ApiResponse;
use think\APP;
use think\Request as Request;

/**
 * CardMessageComment 控制器
 * Class CardMessageComment
 * @package app\index\controller\consulting
 */
class CardMessageComment
{
    // 请求参数
    private Request $request;

    // service
    private MessageCardCommentService $service;

    public function __construct(Request $request, MessageCardCommentService $cardMessageCommentService)
    {
        $this->request = $request;
        $this->service = $cardMessageCommentService;
    }

    /**
     * 评价卡片消息内评价
     * @param \app\index\model\UM $user
     * @return ApiResponse
     * @url /consulting/card_message_comment/save
     */
    public function save(UM $user): ApiResponse
    {
        $request = $this->request;

        $this->service->add($user, $request->param());

        return ApiResponse::success(null);
    }

}
